{% extends "baseD.html" %}

{% block headtitle %}- View From Your Window{% endblock %}

{% block css %}{% endblock %}

{% block scripts %}
	<script type="text/javascript">
		function seeWhy() {
			var ele = document.getElementById("why");
			var menu = document.getElementById("cwhy");
			if(ele.style.display == "block") {
				ele.style.display = "none";
				menu.innerHTML = "See Why [+]";
			}
			else {
				ele.style.display = "block";
				menu.innerHTML = "See Why [-]";
			}
		}
		function seeTut() {
			var ele = document.getElementById("tut");
			var menu = document.getElementById("ctut");
			if(ele.style.display == "block") {
				ele.style.display = "none";
				menu.innerHTML = "View Tutorial Video [+]";
			}
			else {
				ele.style.display = "block";
				menu.innerHTML = "View Tutorial Video [-]";
			}
		}
		function useCurrentVFYW() {
			document.getElementById('url').value = "{{vfywImageURL}}";
			document.getElementById('isvfyw').value = "True";
			document.forms['newImage'].submit();
		}
	</script>
{% endblock %}

{% block onload %} {% endblock %}

{% block divtitle %}- VFYW{% endblock %}

{% block content %}

	<div id="centercontent">
		<div>
			<span class="title">View From Your Window Contest</span>
			<p class="text">
				<img src="{{vfywImageURL}}" id="vfyw" width="400px" />
				Ever lost a <a href="http://www.theatlantic.com/daily-dish/archive/2009/11/-the-view-from-your-window-first-run-sold-out/193630/" target="_blank">View From Your Window</a> contest because you got the wrong window? We can help! We built an interface that allows you to map points in an image to points on Google Earth, to figure out exactly where, in 3D, a camera is.
			</p>
			<p class="text">
				This is the current View From Your Window contest image. Visit Andrew Sullivan's blog <a href="{{archiveURL}}" target="_blank">here</a> and look for the contest entry for details.
			</p>
		</div>
		<div style="clear:both;"></div>
		<div style="margin-top:20px;">
			<span class="title">VFYW Location Tool</span>
			<p class="text">
				{% if username %}
					<input type="button" onclick="useCurrentVFYW();" id="submitbutton" value="Use Current Contest Image" style="float:left;margin-top:45px;" />
					<img src="../live3dstatic/images/or.png" style="float:left;margin:0 20px;"/>
					<form name="newImage" id="newimage" action="build" method="get" style="float:left;margin-top:30px;" onsubmit="return !this.url.value==''">
					    What is the URL of the image you want to use? <br />
					    <input type="hidden" id="createScn" name="createScn" value="True" />
					    <input type="hidden" id="isvfyw" name="isvfyw" value="False" />
					    <input type="text" id="url" name="url" value="" />
					    <input type="submit" value="Use This Image URL" id="submitbutton"/><br />
					</form>
				{% else %}
					<div style="padding:10px;border:2px solid red;">You must <a href="{{logInURL}}">log in</a> before using the VFYW tool.</div>
				{% endif %}
			</p>
		</div>
		<div style="clear:both;"></div>
		<div style="margin-top:20px;">
			<span class="title">Caveats</span>
			<ul class="text">
				<li>This might not work for you at all, and we absolutely don't promise that it gives the right answer. <a id="cwhy" href='javascript:seeWhy();' style="font-size:14px;">See Why [+]</a>
					<div id="why" style="display:none; margin:15px 15px 15px 0;">
						<ol>
							<li>It's surprisingly difficult to click on exactly matching points in the two images.  If one point is mismatched (especially if you mis-click and put the point far in the background instead of on a building), the solution can be far off.</li>
							<li>Google Earth geometry may be wrong.  Some buildings are missing, others have models inferred from aerial imagery which are good but not always great.</li>
							<li>If the camera is a fisheye camera, or is otherwise distorted, this may not fit the camera model that we are solving for (a pinhole camera model).</li>
						</ol>
					</div>
				</li>
				<li>You need the <a href="http://www.google.com/earth/explore/products/plugin.html" target="_blank">Google Earth plug-in</a> to use the tool.</li>
				<li>You must already know the approximate location of the camera.</li>
				<li>You will need to <a href="{{logInURL">log in</a> with your Google username to contribute content</li>
			</ul>
		</div>
	</div>
{% endblock %}
		
{% block scripts2 %} {% endblock %}
